source ~/.local/bin/ubuild.sh
cd $SCRIPT_FOLDER
port=`vue_port`

lombok(){
  ./build.sh lombok `ybuild.sh randw` `ybuild.sh randw` `ybuild.sh randw` `ybuild.sh randw`
}

index(){
  url=http://localhost:$port/?tt=`date +"%s"`
  #curl -X GET $url | tee $LOG_FILE
  open_url $url
}
xxx(){
  open_url http://localhost:$port/xxx
}
query(){
  curl -v http://localhost:$port/bbs/pref/query
}

uwsgi_serv(){
  temp_py=$RANDOM.py
  log_file=$RANDOM.log
  port=$RANDOM
  cat >log/$temp_py<<EOF  
def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return [b"Hello Hero, all for one "]
EOF

  uwsgi_sh=$RANDOM.sh
  cat >log/$uwsgi_sh<<EOF
set -x
uwsgi --http :$port --wsgi-file log/$temp_py
#PID=\$!
#echo "\${PID}">uwsgi.pid
EOF

  chmod +x log/$uwsgi_sh
  nohup ./log/$uwsgi_sh >>log/$log_file 2>&1 &
  sleep 1
  curl -X GET http://localhost:$port/ | tee log/$log_file
  echo
  #uwsgi --stop $PWD/uwsgi.pid
    #PID=`cat uwsgi.pid`
  #sudo kill 9 $PID
  ps -ef|grep wsgi|awk '{print $2}'|xargs kill 9
  sleep 1
  ps -ef|grep uwsgi
}

$@
cd $CD
